<?php
namespace App\Models;

use App\Exceptions\ApiErrorException;
use App\Util\ArrayUtil;


/**
 * 商品SKU套餐模型
 * Class GoodsSkuMeal
 * @package app\model
 */
class GoodsRentSkuMeal extends BaseModel
{
    const KEY = 'id';
    const TABLE = 'sp_goods_rent_sku_meal';

    protected $table = self::TABLE;
    protected $primaryKey = self::KEY;
    protected $connection = 'mysql';

    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';

    protected $guarded = [];

    protected $casts = [
        'create_time' => 'datetime:Y-m-d H:i:s',
        'update_time' => 'datetime:Y-m-d H:i:s',
    ];

    // 显式设置 snakeAttributes 为 true

    public function GoodsRentMealValue()
    {
        return $this->belongsTo(GoodsRentMealValue::class, 'meal_value_id', 'meal_value_id')->select('meal_value', 'meal_id', 'meal_value_id');
    }

    public function goods_rent_meal_value()
    {
        return $this->belongsTo(GoodsRentMealValue::class, 'meal_value_id', 'meal_value_id');
    }

    public function goods_rent_sku()
    {
        return $this->hasOne(GoodsRentSku::class, 'id', 'goods_sku_id');
    }



}
